package openapi

type Options struct {
	// swaggerPath string
	// openapiPath string
	template   string
	replaceMap map[string]string
}

type Option func(*Options)

func NewOptions(opt ...Option) *Options {
	opts := &Options{
		replaceMap: make(map[string]string),
		template:   "",
	}
	opts.replaceMap["{SwaggerPath}"] = "swagger" // 默认路径

	for _, o := range opt {
		o(opts)
	}

	return opts
}

func WithSwaggerPath(path string) Option {
	return func(opts *Options) {
		opts.replaceMap["{SwaggerPath}"] = path
	}
}

func WithOpenapiPath(path string) Option {
	return func(opts *Options) {
		opts.replaceMap["{SwaggerUIDocUrl}"] = path
	}
}

func WithReplace(template, value string) Option {
	return func(opts *Options) {
		opts.replaceMap[template] = value
	}
}

// 使用外部模板
func WithTemplate(value string) Option {
	return func(opts *Options) {
		opts.template = value
	}
}
